home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Resources / HTMLGate 12.2.1B / htmlgate.exe / {app} / Cookies / cookie6.txt < prev    next >
Text File  |  2002-09-26  |  691b  |  23 lines

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!--
  3.  
  4.   var cookieObject = document.cookie; // retrieve cookie string
  5.  
  6.   function getCookie(name) { // use: getCookie("name");
  7.     var index = cookieObject.indexOf(name + "=");
  8.     if (index == -1) return null;
  9.     index = cookieObject.indexOf("=", index) + 1;
  10.     var endstr = cookieObject.indexOf(";", index);
  11.     if (endstr == -1) endstr = cookieObject.length;
  12.     return unescape(cookieObject.substring(index, endstr));
  13.   }
  14.  
  15.   if (!getCookie("visited")) {
  16.     alert("This message appears only on your first visit.\r\nA cookie remembers that the message has been presented.");
  17.     document.cookie = "visited=true";
  18.   }
  19.  
  20. -->
  21. </SCRIPT>
  22.  
  23.